import { ComponentMetadata, Snippet } from '@alilc/lowcode-types';

const StaffManagementLeftMeta: ComponentMetadata = {
  componentName: 'StaffManagementLeft',
  title: '员工管理左侧',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  group: '员工管理',
  category: '数据展示',
  priority: 0,
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'StaffManagementLeft',
    main: 'src/index.tsx',
    destructuring: true,
    subName: '',
  },
  configure: {
    props: [
      {
        title: '基础配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'width',
            title: '组件宽度',
            setter: 'NumberSetter',
            defaultValue: 500,
          },
          {
            name: 'height',
            title: '组件高度',
            setter: 'NumberSetter',
            defaultValue: 1075,
          },
          {
            name: 'noResponsiveScale',
            title: '禁用响应式缩放',
            setter: 'BoolSetter',
            defaultValue: true,
          },
        ],
      },
      {
        title: '员工监管组件配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'staffMonitor.title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '在岗监管',
          },
          {
            name: 'staffMonitor.englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Online supervision',
          },
          {
            name: 'staffMonitor.staffStats',
            title: '员工统计',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'icon',
                          title: '图标路径',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'count',
                          title: '数量',
                          setter: ['StringSetter', 'NumberSetter'],
                        },
                        {
                          name: 'unit',
                          title: '单位',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'label',
                          title: '标签',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/Group1000014674.png',
                count: 40,
                label: '保安',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/Group1000014674(1).png',
                count: 40,
                unit: '人',
                label: '保洁',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/Group 1000014674(2).png',
                count: 40,
                unit: '人',
                label: '出租车管理',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/Group1000014674.png',
                count: 40,
                unit: '人',
                label: '网约车管理',
              },
            ],
          },
          {
            name: 'staffMonitor.offDutyRecords',
            title: '脱岗记录',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'employee',
                          title: '员工',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'position',
                          title: '岗位',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'offDutyStartTime',
                          title: '脱岗开始时间',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'offDutyDuration',
                          title: '脱岗时长',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                key: '1',
                employee: '员工1',
                position: '网页车管理员',
                offDutyStartTime: '14:07:01',
                offDutyDuration: '2:37:17',
              },
              {
                key: '2',
                employee: '员工2',
                position: '网页车管理员',
                offDutyStartTime: '14:07:01',
                offDutyDuration: '2:37:17',
              },
              {
                key: '3',
                employee: '员工3',
                position: '网页车管理员',
                offDutyStartTime: '14:07:01',
                offDutyDuration: '2:37:17',
              },
            ],
          },
          {
            name: 'staffMonitor.offDutyStats',
            title: '脱岗统计',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'icon',
                          title: '图标路径',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'count',
                          title: '数值',
                          setter: ['StringSetter', 'NumberSetter'],
                        },
                        {
                          name: 'label',
                          title: '标签',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/01备份.png',
                count: 37,
                label: '脱岗人数',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/01.png',
                count: '网页车管理员',
                label: '脱岗最多岗位',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/01.png',
                count: '7%',
                label: '脱岗率',
              },
              {
                icon: 'http://localhost:8085/static/images/yuangongguanli/01.png',
                count: '2:30',
                label: '脱岗平均时长',
              },
            ],
          },
        ],
      },
      {
        title: '轨迹查看组件配置',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'trackView.title',
            title: '组件标题',
            setter: 'StringSetter',
            defaultValue: '轨迹查看',
          },
          {
            name: 'trackView.englishTitle',
            title: '英文标题',
            setter: 'StringSetter',
            defaultValue: 'Track View',
          },
          {
            name: 'trackView.searchPlaceholder',
            title: '搜索占位符',
            setter: 'StringSetter',
            defaultValue: '请输入员工名字',
          },
          {
            name: 'trackView.trackRecords',
            title: '轨迹记录',
            setter: {
              componentName: 'ArraySetter',
              props: {
                itemSetter: {
                  componentName: 'ObjectSetter',
                  props: {
                    config: {
                      items: [
                        {
                          name: 'key',
                          title: '唯一标识',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'employee',
                          title: '员工',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'position',
                          title: '位置',
                          setter: 'StringSetter',
                        },
                        {
                          name: 'track',
                          title: '轨迹操作',
                          setter: 'StringSetter',
                        },
                      ],
                    },
                  },
                },
              },
            },
            defaultValue: [
              {
                key: '1',
                employee: '员工1',
                position: '东区',
                track: '查看',
              },
              {
                key: '2',
                employee: '员工2',
                position: '东区',
                track: '查看',
              },
              {
                key: '3',
                employee: '员工3',
                position: '东区',
                track: '查看',
              },
              {
                key: '4',
                employee: '员工4',
                position: '东区',
                track: '查看',
              },
            ],
          },
        ],
      },
      {
        title: '事件处理',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'staffMonitor.onClick',
            title: '员工监管点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'trackView.onSearch',
            title: '轨迹搜索事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'trackView.onTrackClick',
            title: '轨迹点击事件',
            setter: 'FunctionSetter',
          },
          {
            name: 'trackView.onClick',
            title: '轨迹组件点击事件',
            setter: 'FunctionSetter',
          },
        ],
      },
      {
        title: '外观',
        display: 'block',
        type: 'group',
        items: [
          {
            name: 'style',
            title: '自定义样式',
            setter: 'StyleSetter',
          },
          {
            name: 'className',
            title: '自定义类名',
            setter: 'StringSetter',
          },
        ],
      },
    ],
    supports: {
      style: true,
      events: ['onClick'],
    },
    component: {},
  },
};

const snippets: Snippet[] = [
  {
    title: '员工管理左侧',
    screenshot: '',
    schema: {
      componentName: 'StaffManagementLeft',
      props: {
        width: 500,
        height: 1075,
        noResponsiveScale: true,
        staffMonitor: {
          title: '在岗监管',
          englishTitle: 'Online supervision',
          staffStats: [
            { icon: 'http://localhost:8085/static/images/yuangongguanli/zaigang-one.png', count: 40, unit: '人', label: '保安' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/zaigang-two.png', count: 40, unit: '人', label: '保洁' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/zaigang-three.png', count: 40, unit: '人', label: '出租车管理' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/zaigang-four.png', count: 40, unit: '人', label: '网约车管理' }
          ],
          offDutyRecords: [
            {
              key: '1',
              employee: '员工1',
              position: '网页车管理员',
              offDutyStartTime: '14:07:01',
              offDutyDuration: '2:37:17',
            },
            {
              key: '2',
              employee: '员工2',
              position: '网页车管理员',
              offDutyStartTime: '14:07:01',
              offDutyDuration: '2:37:17',
            },
            {
              key: '3',
              employee: '员工3',
              position: '网页车管理员',
              offDutyStartTime: '14:07:01',
              offDutyDuration: '2:37:17',
            },
          ],
          offDutyStats: [
            { icon: 'http://localhost:8085/static/images/yuangongguanli/tuogxinx-one.png', count: 37, label: '脱岗人数' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/tuogxinx-two.png', count: '网页车管理员', label: '脱岗最多岗位' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/tuogxinx-three.png', count: '7%', label: '脱岗率' },
            { icon: 'http://localhost:8085/static/images/yuangongguanli/tuogxinx-four.png', count: '2:30', label: '脱岗平均时长' }
          ],
        },
        trackView: {
          title: '轨迹查看',
          englishTitle: 'Track View',
          searchPlaceholder: '请输入员工名字',
          trackRecords: [
            {
              key: '1',
              employee: '员工1',
              position: '东区',
              track: '查看',
            },
            {
              key: '2',
              employee: '员工2',
              position: '东区',
              track: '查看',
            },
            {
              key: '3',
              employee: '员工3',
              position: '东区',
              track: '查看',
            },
            {
              key: '4',
              employee: '员工4',
              position: '东区',
              track: '查看',
            },
          ],
        },
      },
    },
  },
];

export default {
  ...StaffManagementLeftMeta,
  snippets,
};
